﻿using System;
using System.Collections;
using UnityEngine;

namespace CalmNine.Framework {
    public class GlobalMono : MonoSingleton<GlobalMono>
    {
        public readonly EasyEvent OnUpdate = new EasyEvent();
        public readonly EasyEvent OnFixedUpdate = new EasyEvent();
        public readonly EasyEvent OnLateUpdate = new EasyEvent();
        public readonly EasyEvent OnGUIEvent = new EasyEvent();
        public readonly EasyEvent<bool> OnApplicationFocusEvent = new EasyEvent<bool>();
        public readonly EasyEvent<bool> OnApplicationPauseEvent = new EasyEvent<bool>();
        public readonly EasyEvent OnApplicationQuitEvent = new EasyEvent();
        
        private void Update()
        {
            OnUpdate?.Trigger();
        }

        private void OnGUI()
        {
            OnGUIEvent?.Trigger();
        }

        private void FixedUpdate()
        {
            OnFixedUpdate?.Trigger();
        }

        private void LateUpdate()
        {
            OnLateUpdate?.Trigger();
        }

        private void OnApplicationFocus(bool hasFocus)
        {
            OnApplicationFocusEvent?.Trigger(hasFocus);
        }

        private void OnApplicationPause(bool pauseStatus)
        {
            OnApplicationPauseEvent?.Trigger(pauseStatus);
        }

        private void OnApplicationQuit()
        {
            OnApplicationQuitEvent?.Trigger();
        }

    }
}


